<?php
/**
 * Created by PhpStorm.
 * User: a4041
 * Date: 2018/6/13
 * Time: 13:46
 */

namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
    protected $guarded = ['id'];
//    protected $fillable = ['shop_id','order_id','user_id','score','content'];

    public function getShopComments($shop_id){
        $res = $this->where('shop_id',$shop_id)->paginate();
        return $res;
    }

    public function getUserComments($user_id){
        $res = $this->where('user_id',$user_id)->paginate();
        return $res;
    }

    public function users()
    {
        return $this->belongsTo('App\Models\User','user_id','id');
    }
}